import { useAppStore } from '@/store/modules/app.js'
import { useI18n } from 'vue-i18n'
export function useLanguage() {
  const { locale } = useI18n()
  const appStore = useAppStore()
  const setLanguage = (language, reload) => {
    if (language) {
      appStore.setLanguage(language)
      locale.value = language
      appStore.reloadApp()
      // reload && location.reload()
    }
  }
  return {
    setLanguage,
    nowLanguage: appStore.lang,
  }
}
